<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@page import="com.wanmait.hotelManage.vo.Room"%>
<%@page import="com.wanmait.hotelManage.vo.RoomType"%>
<%@page import="java.util.List"%>
    <%
    String path=request.getContextPath();
    List<RoomType>roomTypelists=(List<RoomType>)request.getAttribute("roomtypes");
    %>
<jsp:include page="/manage/inc/header.jsp"></jsp:include>
<jsp:include page="/manage/inc/menu.jsp"></jsp:include>
    <!--/sidebar-->
    <div class="main-wrap">

        <div class="crumb-wrap">
            <div class="crumb-list"><i class="icon-font"></i><a href="/jscss/admin/design/">首页</a><span class="crumb-step">&gt;</span><a href="<%=path%>/manage/RoomServlet?action=list">客房管理</a><span class="crumb-step">&gt;</span><span>新增作品</span></div>
        </div>
        <div class="result-wrap">
            <div class="result-content">
                <form action="<%=path %>/manage/RoomServlet?action=insert" method="post" id="myform" name="myform" >
                    <table class="insert-tab" width="100%">
                        <tbody>
                            <tr>
                                <th><i class="require-red">*</i>房间号：</th>
                                <td>
                                    <input class="common-text required" id="number" name="number" size="10" value="" type="text"><span id="spanid"></span>
                                </td>
                            </tr>
                           <tr>
                            <th width="120"><i class="require-red">*</i>房间类型：</th>
                            <td>
                                <select name="colId" id="catid" class="required">
                                    <%
                                    if(roomTypelists!=null){
                                    	for(int i=0;i<roomTypelists.size();i++){
                                    		RoomType roomtype=roomTypelists.get(i);
                                    		%>
                                    		<option value="<%=roomtype.getId()%>"><%=roomtype.getTitle() %></option>
                                    		<%
                                    }
                                    }
                                    %>
                                    
                                </select>
                            </td>
                            </tr>
                       <tr>
                                <th></th>
                                <td>
                                    <input class="btn btn-primary btn6 mr10" id="mybtn" value="提交" type="button">
                                    <input class="btn btn6" id="resetbutton" value="返回" type="button">
                                </td>
                            </tr>
                        </tbody></table>
                </form>
            </div>
        </div>

    </div>
    <!--/main-->
</div>
<jsp:include page="/manage/inc/footer.jsp"></jsp:include>
<script>
<%--$(function(){
	$("#catid").change(function(){
		var chlick=$("#catid").val();
		
	})
})--%>
</script>
<script>
$("#resetbutton").click(function(){
	window.location.href="<%=path%>/manage/RoomServlet?action=list";
})
</script>
<script>
$(function(){
	$("#mybtn").click(function(){
		var number=$("#number").val();
		var patt=/^[0-9]*$/;
		if(patt.test(number)){
			$("#spanid").html("");
		}else{
			$("#spanid").html("输入的不是数字或者为空");
			return false;
		}
		$("#myform").submit();
	})
})
</script>